<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工程合同审批</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../resources/css/style.css" media="all">
    <style>
        /*.layui-form-pane .layui-input-block{margin-left: 82px;}*/
        .saixuan:after{width: 0;}
        .layui-form-pane .layui-input-block{margin-left: 0;}

        @media screen and (max-width: 1280px) {
            .layui-form-pane .layui-form-label{width: 108px;}
        }
        .layui-form-item .layui-input-inline{width: 80%;}
        @media only screen and (min-width: 321px) and (max-width: 1024px) {
            .formTop .layui-col-xs4{width: 25%;}
        }
        .layui-btn+.layui-btn{margin-left: 0;}
        .layui-input-inline,.layui-input-block{width: 80%;}
        .layui-form-item{margin-bottom: 0;}
    </style>
</head>
<body>
<form class="layui-form layui-form-pane" id="form_7grid" action="" >
    <div class="formTop layui-row">
        <div class="layui-form-item layui-col-lg3 layui-col-md3 layui-col-xs3">
            <div class="layui-input-inline">
                <input type="text" name="cc_code" lay-verify="required" placeholder="工程名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-xs3">
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="test-limit3" placeholder="请选择创建开始日期">
                <div class="icons">

                </div>
            </div>
        </div>
        <div class="layui-inline layui-col-l3 layui-col-md3 layui-col-xs3">
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="test-limit4" placeholder="请选择创建结束日期">
                <div class="icons">

                </div>
            </div>
        </div>
        <div class="layui-inline layui-col-lg2 layui-col-md2 layui-col-xs2">

            <div class="layui-input-block">
                <select name="state" lay-filter="aihao">
                    <option value="" selected="">请选择审核状态</option>
                    <option value="0">审核通过</option>
                    <option value="-1">等待审核</option>
                    <option value="1">不通过</option>
                </select>
            </div>
        </div>
        <div class="layui-col-lg1 layui-col-md1 layui-col-xs1" style="text-align: right;">
            <button class="layui-btn" type="button" onclick="query()" style="float: left;">查询</button>

        </div>

    </div>

    <table id="demo" lay-filter="test"></table>

    <div id="demo7"></div>
    <a class="dayin" type="button" id="dlink"  style="float: right; position: fixed; right: 50px; bottom: 50px; z-index: 999;"></a>

    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-sm chakan quanxian" lay-event="detail" QX="api/contract/conValiDetails.do">查看</a>
        {{# if(d.cc_result === -1 || d.state === -1 ) {}}
        <a class="layui-btn layui-btn-sm shenhe quanxian" lay-event="toExamine" style="background-color: #FF5722;" QX="api/contract/conVali.do">审核</a>
        {{# } else if(d.cc_result === 0) { }}
        <a class="layui-btn layui-btn-sm shenhe quanxian" lay-event="qxVali" style="background-color: #FF5722;" QX="api/contract/conVali.do">取消审核</a>
        {{# }}}
    </script>



</form>

<script src="../../../resources/layui/layui.js" charset="utf-8"></script>
<script src="../../../resources/js/style.js"></script>
<script src="../../../resources/js/api.js"></script>

<script>
    function query() {
        layui.use(['form', 'layedit', 'laydate','table','element'], function() {
            var form = layui.form
                , table = layui.table;
            var pronName=$("[name='cc_code']").val();      //获取查询值
            var begintime=$('#test-limit3').val();          //获取查询开始时间
            var endtime=$('#test-limit4').val();            //获取查询结束时间
            var state=$('[name="state"]').val();         //获取状态值

            $('#form_7grid').attr('action',urls+'/erpbuild/api/contract/conValiList.do');


            if(!AntiSqlValid(pronName)){           //判断是否包含特殊符号
                if(lbq('api/contract/conValiList.do')) {
                    API.shenpi({
                        'proName': pronName,
                        'begintime': begintime,
                        'endtime': endtime,
                        'state': state,
                        'p': getCookie('yanzheng')
                    })
                }
            }else {
                layer.msg('请勿输入特殊符号');
            };
        })
    }
    layui.use(['form', 'layedit', 'laydate','table','element'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table=layui.table
            ,element=layui.element;
        jiazais();

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';        //代替另一个对象调用一个方法。call 方法可将一个函数的对象上下文从初始的上下文改变为由 thisObj 指定的新对象。
        });
        if(lbq('api/contract/conValiList.do')){
            API.shenpi({'p':getCookie('yanzheng')})
        }


        //前后若干天可选，这里设置不能选过去的日期      最远可选1000天之后
        panduanshijiantow('#test-limit3','#test-limit4',1000,1000,'.layui-btn-normal');     //查询 开始结束时间判断
        dayintishi('.dayin');
        //监听工具条
        table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象

            if(layEvent === 'detail'){ //查看
                //do somehing
                //console.log(obj)
                sessionStorage.shenpiUID=obj.data.cc_UUID;
                sessionStorage.stear='detail';                //拼接上detail  跳转页面判断
                window.location.href='./shenpiSee.html';
            }else if( layEvent==='toExamine'){      //审核
                sessionStorage.shenpiUID=obj.data.cc_UUID;
                sessionStorage.stear='toExamine';             //拼接上detail  跳转页面判断
                window.location.href='./shenpiSee.html';
            }else if ( layEvent==='qxVali' ){
                //取消审核
                layer.alert('您确定要取消审核此合同吗?',{
                    closeBtn:1 //是否显示关闭按钮
                    ,anim: 1 //动画类型
                    ,btn: ['确认','取消']
                    ,icon: 6
                    ,yes:function () {
                        var shijian=Date.parse(new Date());                 //获取当前时间戳
                        shijian=times(shijian);                                //时间戳格式转换
                        ajaxs('/api/contract/cancelConcractValidate.do','post',{
                            'uuid':data.cc_UUID,'p':getCookie('yanzheng') },function (data) {
                            layer.msg(data.msg);
                            setTimeout(function () {
                                location.reload();
                            },1000)
                        })
                    },btn2:function () {}
                });
            }
        });



    })

</script>
</body>
</html>